package com.puti.doctor.controller;

import com.github.pagehelper.Page;
import com.puti.common.core.domain.R;
import com.puti.doctor.domain.vo.EvaluationVo;
import com.puti.doctor.service.IPatientDoctorEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/evaluation")
public class PatientDoctorEvaluationController {
    @Autowired
    private IPatientDoctorEvaluationService iPatientDoctorEvaluationService;
    //接诊台-已接诊列表-评价：可查看该患者评价；
    @RequestMapping("/{recordId}")
    public R findEvaluation(@PathVariable("recordId") Long recordId){
        EvaluationVo evaluation = iPatientDoctorEvaluationService.findEvaluation(recordId);
        if (evaluation!=null){
            return R.ok(evaluation,"查询成功");
        }else{
            return R.fail("未查询到评价");
        }
    }
    //诊断管理-查看患者评价-弹出评价框；
    @RequestMapping("/time/{doctorId}")
    public R findEvaluationTime(@RequestParam("recordTime") String recordTime, @PathVariable("doctorId") Long doctorId,int page,int pageSize){
        Page evaluationTime = iPatientDoctorEvaluationService.findEvaluationTime(recordTime, doctorId,page,pageSize);
        if(evaluationTime!=null){
            return R.ok(evaluationTime,"查询成功");
        }else{
            return R.fail("暂时无数据!");
        }
    }
}
